package com.dony.shop.domain.enums;

public enum LazadaCountryEnum {
    Malaysia("my","https://api.lazada.com.my/rest"),
    Philippines("ph","https://api.lazada.com.ph/rest"),
    Vietnam("vn","https://api.lazada.vn/rest"),
    Indonesia("id","https://api.lazada.co.id/rest"),
    Singapore("sg","https://api.lazada.sg/rest"),
    Thailand("th","https://api.lazada.co.th/rest");

    private String country;
    private String url;

    private LazadaCountryEnum(String name, String url) {
        this.country = name;
        this.url = url;
    }

    // get set 方法
    public String getCountry() {
        return country;
    }
    public void setCountry(String name) {
     this.country = name;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String index) {
        this.url = url;
    }

    // 普通方法
    public static String getUrl(String country) {
        LazadaCountryEnum[] values = LazadaCountryEnum.values();
        for (LazadaCountryEnum value : values) {
            if (value.getCountry().equalsIgnoreCase(country)) {
                return value.url;
            }
        }
        return null;
    }
}
